package com.campus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.campus.entity.Honor.HonorTemplate;
import com.campus.mapper.HonorTemplateMapper;
import com.campus.service.HonorTemplateService;
import org.springframework.stereotype.Service;

/**
 * @author Alaskaboo
 * @description 针对表【t_honor_template】的数据库操作Service实现
 * @createDate 2022-10-26 23:23:24
 */
@Service
public class HonorTemplateServiceImpl extends ServiceImpl<HonorTemplateMapper, HonorTemplate> implements HonorTemplateService {
    /**
     * 查询所有学生
     *
     * @param page
     * @param honorTemplate
     * @return
     */
    @Override
    public IPage<HonorTemplate> honorTemplateList(Page<HonorTemplate> page, HonorTemplate honorTemplate) {
        QueryWrapper<HonorTemplate> queryWrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(honorTemplate.getAwardCategory())) {
            queryWrapper.like("award_category", honorTemplate.getAwardCategory());
        }
        if (!StringUtils.isEmpty(honorTemplate.getAwardLevel())) {
            queryWrapper.like("account", honorTemplate.getAwardLevel());
        }
        queryWrapper.orderByAsc("id");
        return baseMapper.selectPage(page, queryWrapper);
    }
}




